"""
事件基类，所有窗口事件类都要继承这个基类
"""
from TestToolsV2.components.BaseComponent import baseComponent



class baseEvent:
    def __init__(self, qWidgets: baseComponent):
        self.__qWidget = qWidgets

    def set_trigger(self, componentName, func):
        self.__qWidget.get_component(componentName).triggered.connect(func)

    def set_returnPress(self, componentName, func):
        self.__qWidget.get_component(componentName).returnPressed.connect(func)

    def set_editingFinish(self, componentName, func):
        self.__qWidget.get_component(componentName).editingFinished.connect(func)

    def set_click(self, componentName, func):
        self.__qWidget.get_component(componentName).clicked.connect(func)

    def set_textChang(self, componentName, func):
        self.__qWidget.get_component(componentName).textChanged.connect(func)
